Multi-Protocol Label Switching (MPLS) is a data-carrying protocol that may be used in packet-switched computer or telecommunications networks. MPLS may be used to carry many different types of traffic, including, for example, Internet Protocol (IP) packets, ATM cells, SONET frames, and Ethernet frames. MPLS involves prefixing packets with an MPLS header that contains one or more “labels called a “label stack.” Each label stack entry may contain a label value, a Quality of Service (QoS) field that indicates the QoS requirements for the packet, a “bottom of stack” flag that indicates the last label in the stack, and a time to live (TTL) field. When a packet with an MPLS header is received at a router, it is switched after a label look-up instead of a lookup into an IP table.
Entry and exit points of an MPLS network are called Label Edge Routers (LER). Ingress LERs push the MPLS label onto the incoming packet and the egress LER pops the MPLS label off the outgoing packet. When an unlabeled packet enters an ingress LER, the ingress LER inserts one or more labels in the packet's newly created MPLS header. The packet may then be passed on to the next hop router for the MPLS tunnel. When a labeled packet is received by an MPLS router, the topmost label is examined. Based on the contents of the label, a swap, push or pop operation can be performed on the packet's label stack. The routers use lookup tables to determine which kind of operation to perform based on the topmost label of the incoming packet. In a swap operation, the label is swapped with a new label, and the packet is forwarded along the path associated with the new label. In a push operation, a new label is pushed on top of the existing label, effectively “encapsulating” the packet in another layer of MPLS. This permits hierarchical routing of MPLS packets. In a pop operation, the label is removed from the packet, which may reveal an inner label below (i.e., the packet is “decapsulated”). If the popped label was the last label in the label stack, the packet leaves the MPLS tunnel. At the egress LER, when the last label has been popped, only the payload remains. This can be an IP packet, or any of a number of other kinds of payloads.